{template '_header'}

<div class="page-heading">
    <span class='pull-right'>
        {ifp 'shop.refundaddress.add'}
        	<a class='btn btn-primary btn-sm' href="{php echo webUrl('shop/refundaddress/add')}"><i class='fa fa-plus'></i> 添加退货地址</a>
        {/if}
    </span>
    <h2><i class="fa fa-circle-o"></i>退货地址管理</h2> </div>

<form action="" method="get" class="form-horizontal form-search" role="form">
    <input type="hidden" name="c" value="site" />
    <input type="hidden" name="a" value="entry" />
    <input type="hidden" name="m" value="ewei_shopv2" />
    <input type="hidden" name="do" value="web" />
    <input type="hidden" name="r"  value="shop.refundaddress" />
    <div class="page-toolbar row m-b-sm m-t-sm">
        <div class="col-sm-4">
            <div class="input-group-btn">
                <button class="btn btn-default btn-sm"  type="button" data-toggle='refresh'><i class='fa fa-refresh'></i></button>
                {ifp 'shop.refundaddress.delete'}
                	<button class="btn btn-default btn-sm" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{php echo webUrl('shop/refundaddress/delete')}"><i class='fa fa-trash'></i> 删除</button>
                {/if}
            </div>
        </div>	


        <div class="col-sm-6 pull-right">
            <div class="input-group">
                <input type="text" class="input-sm form-control" name='keyword' value="{$_GPC['keyword']}" placeholder="请输入关键词"> <span class="input-group-btn">
                    <button class="btn btn-sm btn-primary" type="submit"> 搜索</button> </span>
            </div>

        </div>
    </div>
</form>

<form action="" method="post">
    {if count($list)>0}
    <table class="table table-hove table-responsive">
        <thead class="navbar-inner">
            <tr>
                <th style="width:25px;"><input type='checkbox' /></th>
                <th>名称</th>
                <th style='width:80px;'>联系人</th>
                <th style='width:100px;'>手机</th>
                <th>地址</th>
                <th style='width:60px;'>默认</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {loop $list $item}
            <tr>
                <td>
                    <input type='checkbox' value="{$item['id']}"/>
                </td>

                <td>{$item['title']}</td>
                <td>{$item['name']}</td>
                <td>{$item['mobile']}</td>
                <td>{$item['address']}</td>

                <td>
                    <span class='label {if $item['isdefault']==1}label-success{else}label-default{/if} defaults'
                        {ifp 'shop.refundaddress.edit'}
	                        data-toggle='ajaxSwitch'
	                        data-switch-value='{$item['isdefault']}'
	                        data-switch-value0='0|否|label label-default defaults|{php echo webUrl('shop/refundaddress/setdefault',array('isdefault'=>1,'id'=>$item['id']))}'
	                        data-switch-value1='1|是|label label-success defaults|{php echo webUrl('shop/refundaddress/setdefault',array('isdefault'=>0,'id'=>$item['id']))}'
	                        data-switch-css='.defaults'
	                        data-switch-other = 'true'
                        {/if}
                        >
                        {if $item['isdefault']==1}是{else}否{/if}</span>
                </td>
                <td style="text-align:left;">
                    {ifp 'shop.refundaddress.view|shop.refundaddress.edit'}
                    	<a href="{php echo webUrl('shop/refundaddress/edit', array('id' => $item['id']))}" class="btn btn-default btn-sm">
                    		<i class='fa fa-edit'></i> {ifp 'shop.refundaddress.edit'}修改{else}查看{/if}
                    	</a>
                    {/if}
                    {ifp 'shop.refundaddress.delete'}
                    	<a data-toggle='ajaxRemove' href="{php echo webUrl('shop/refundaddress/delete', array('id' => $item['id']))}"class="btn btn-default btn-sm" data-confirm='确认要删除此退货地址吗?'><i class="fa fa-trash"></i> 删除</a>
                    {/if}
                </td>
            </tr>
            {/loop}

            <tr>
                <td colspan='7'>

                    <div class='pagers' style='float:right;'>
                        {$pager}
                    </div>
                </td>
            </tr>
            </tbody>
        </table>

            {else}
            <div class='panel panel-default'>
                <div class='panel-body' style='text-align: center;padding:30px;'>
                    暂时没有任何退货地址!
                </div>
            </div>
            {/if}
        </form>

        {template '_footer'}